{include file="public/header" /}

<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>商品管理</h3>
        <h5></h5>
      </div>
      {if isset($edit_goods_sign)}
      {include file="public/admin_items" /}
      {else /}
      <ul class="add-goods-step">
        <li><i class="icon fa fa-list-alt"></i>
          <h6>STEP.1</h6>
          <h2>{$Think.lang.select_category}</h2>
          <i class="arrow fa fa-angle-right"></i> </li>
        <li class="current"><i class="icon fa fa-pencil-square"></i>
          <h6>STEP.2</h6>
          <h2>{$Think.lang.fill_item_details}</h2>
          <i class="arrow fa fa-angle-right"></i> </li>
        <li><i class="icon fa fa-camera-retro "></i>
          <h6>STEP.3</h6>
          <h2>{$Think.lang.goods_index_upload_goods_pic}</h2>
          <i class="arrow fa fa-angle-right"></i> </li>
        <li><i class="icon fa fa-check-circle-o"></i>
          <h6>STEP.4</h6>
          <h2>{$Think.lang.goods_index_flow_chart_step3}</h2>
        </li>
      </ul>
      {/if}
    </div>
  </div>
  <div class="fixed-empty"></div>


  <div id="fixedNavBar">
    <h3>{$Think.lang.page_navigation}</h3>
    <ul>
      <li><a id="demo1Btn" href="#demo1" class="demoBtn">{$Think.lang.basic_information}</a></li>
      <li><a id="demo7Btn" href="#demo7" class="demoBtn">申报相关</a></li>
      <li><a id="demo2Btn" href="#demo2" class="demoBtn">{$Think.lang.detailed_description}</a></li>
      <li><a id="demo3Btn" href="#demo3" class="demoBtn">{$Think.lang.special_goods}</a></li>
      <li><a id="demo4Btn" href="#demo4" class="demoBtn">{$Think.lang.logistics_freight}</a></li>
      <li><a id="demo5Btn" href="#demo5" class="demoBtn">{$Think.lang.invoice_information}</a></li>
      <li><a id="demo6Btn" href="#demo6" class="demoBtn">{$Think.lang.goods_index_goods_other_info}</a></li>
    </ul>
  </div>










  <div class="item-publish">
    <form method="post" id="goods_form" action="{if isset($edit_goods_sign)}{:url('Goods/edit_save_goods')}{else/}{:url('Goodsadd/save_goods')}{/if}">
      <input type="hidden" name="commonid" value="{$goods.goods_commonid|default=''}" />
      <input type="hidden" name="goods_id" value="{$goods.goods_id|default=''}" />
      <input type="hidden" name="type_id" value="{$goods_class.type_id|default=''}" />
      <div class="sc-form-goods">
        <h3 id="demo1">{$Think.lang.goods_index_goods_base_info}</h3>
        <!-- 商品类型 -->
<!--        <dl class="trade_mode">-->
<!--          <dt>商品类型</dt>-->
<!--          <dd>-->
<!--            <ul class="sc-form-radio-list">-->
<!--              <?php $trade_mode = config('trade_mode'); ?>-->
<!--              {foreach name="$trade_mode" key="key" item="item"}-->
<!--              <li>-->
<!--                <input type="radio" class="trade_mode" name="trade_mode" id="trade_mode_{$key}" value="{$key}" {if condition="(isset($goods['trade_mode']) && $goods['trade_mode'] == $key) || (!isset($goods['trade_mode']) && $key == TRADE_NORMAL)"}checked{/if}>-->
<!--                <input type="hidden" id="trade_mode" value="{$key}">-->
<!--                <label for="trade_mode_{$key}">{$item}</label>-->
<!--              </li>-->
<!--              {/foreach}-->
<!--            </ul>-->
<!--            <p class="hint vital"></p>-->
<!--          </dd>-->
<!--        </dl>-->
        <dl class="goods_type">
          <dt>商品类型</dt>-->
          <dd>
            <ul class="sc-form-radio-list">
              <li>
                <input type="radio" class="goods_type" name="goods_type" id="goods_type_1" value="1" checked>
                <input type="hidden" value="1">
                <label for="goods_type_1">普通商品</label>
                <input type="radio" class="goods_type" name="goods_type" id="goods_type_2" value="2">
                <input type="hidden" value="2">
                <label for="goods_type_2">保税货物</label>
              </li>
            </ul>
            <p class="hint vital"></p>
          </dd>
        </dl>
        <dl>
          <dt>{$Think.lang.goods_index_goods_class}{$Think.lang.sc_colon}</dt>
          <dd id="gcategory"> {$goods_class.gctag_name|default=''}
            <a class="sc-btn" href="{if isset($edit_goods_sign)}{:url('Goods/edit_class',['commonid'=>$goods['goods_commonid']])}{else/}{:url('Goodsadd/add_step_one')}{/if}">{$Think.lang.sc_edit}</a>
            <input type="hidden" id="cate_id" name="cate_id" value="{$goods_class.gc_id|default=''}" class="text" />
            <input type="hidden" name="cate_name" value="{$goods_class.gctag_name|default=''}" class="text"/>
          </dd>
        </dl>
        <dl>
          <dt><i class="required">*</i>{$Think.lang.sc_goods_name}{$Think.lang.sc_colon}</dt>
          <dd>
              <input name="g_name" type="text" class="text w400 autocomplete" value="{$goods.goods_name|default=''}" />
            <span></span>
            <p class="hint">{$Think.lang.goods_index_goods_name_help}</p>
          </dd>
        </dl>
        <dl>
          <dt>{$Think.lang.selling_point_}{$Think.lang.sc_colon}</dt>
          <dd>
            <textarea name="g_jingle" class="textarea h60 w400">{$goods.goods_advword|default=''}</textarea>
            <span></span>
            <p class="hint">{$Think.lang.price_instructions1}</p>
          </dd>
        </dl>
        <dl>
          <dt sc_type="no_spec"><i class="required">*</i>{$Think.lang.goods_index_price}{$Think.lang.sc_colon}</dt>
          <dd sc_type="no_spec">
            <input name="g_price" value="{$goods.goods_price|default=''}" type="text"  class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>
            <p class="hint">{$Think.lang.goods_index_price_help}，{$Think.lang.price_instructions2}<br>
              {$Think.lang.price_instructions3}</p>
          </dd>
        </dl>
        <dl>
          <dt sc_type="no_spec"><i class="required"></i>促销价{$Think.lang.sc_colon}</dt>
          <dd sc_type="no_spec">
              {$goods.goods_promotion_price}
            <p class="hint">{$Think.lang.goods_index_price_help}，{$Think.lang.price_instructions2}<br>
              {$Think.lang.price_instructions3}</p>
          </dd>
        </dl>
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required">*</i>代理商价格{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            一级：<input name="goods_price_1" value="{$goods.goods_price_1|default=''}" type="text"  class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>-->
<!--            &nbsp;二级：<input name="goods_price_2" value="{$goods.goods_price_2|default=''}" type="text"  class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>-->
<!--            &nbsp;三级：<input name="goods_price_3" value="{$goods.goods_price_3|default=''}" type="text"  class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>-->
<!--            <p class="hint">{$Think.lang.goods_index_price_help}，{$Think.lang.price_instructions2}<br>-->
<!--              {$Think.lang.price_instructions3}</p>-->
<!--          </dd>-->
<!--        </dl>-->

        <dl class="declare">
          <dt sc_type="no_spec"><i class="required">*</i>{$Think.lang.tax_rate}{$Think.lang.sc_colon}</dt>
          <dd sc_type="no_spec">
            <input name="tax_rate" value="{$goods.tax_rate|default=$default_tax_rate}" type="text"  class="text w60" /><em class="add-on">%</em>
          </dd>
        </dl>

        <dl>
          <dt><i class="required">*</i>{$Think.lang.market_price}{$Think.lang.sc_colon}</dt>
          <dd>
            <input name="g_marketprice" value="{$goods.goods_marketprice|default=''}" type="text" class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>
            <p class="hint">{$Think.lang.goods_index_price_help}{$Think.lang.price_instructions4}</p>
          </dd>
        </dl>
        <dl>
          <dt>{$Think.lang.cost_price}{$Think.lang.sc_colon}</dt>
          <dd>
            <input name="g_costprice" value="{$goods.goods_costprice|default=''}" type="text" class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>
            <p class="hint">{$Think.lang.price_instructions5}</p>
          </dd>
        </dl>
        <dl>
          <dt>{$Think.lang.discount}{$Think.lang.sc_colon}</dt>
          <dd>
            <input name="g_discount" value="{$goods.goods_discount|default=''}" type="text" class="text w60" readonly="readonly" style="background:#E7E7E7 none;" /><em class="add-on">%</em>
            <p class="hint">{$Think.lang.specifications_instructions1}</p>
          </dd>
        </dl>
        <?php if(is_array($spec_list) && !empty($spec_list)){?>
        <?php $i = '0';?>
        <?php foreach ($spec_list as $k=>$val){?>
        <dl sc_type="spec_group_dl_{$i}" sctype="spec_group_dl" class="spec-bg" {if $k == '1'}spec_img="t"{/if}>
        <dt>
          <input name="sp_name[{$k}]" type="text" class="text w60 tip2 tr" title="{$Think.lang.specifications_instructions2}" value="<?php if (isset($goods['spec_name'][$k])) { echo $goods['spec_name'][$k];} else {echo $val['sp_name'];}?>" maxlength="4" sctype="spec_name" data-param="{id:<?php echo $k;?>,name:'<?php echo $val['sp_name'];?>'}"/>
          {$Think.lang.sc_colon}
        </dt>
        <dd {if $k == '1'}sctype="sp_group_val"{/if}>
        <ul class="spec">
          <?php if(is_array($val['value'])){?>
          {foreach name="$val.value" item="v" }
          <li><span sctype="input_checkbox">
              <input type="checkbox" value="{$v.spvalue_name}" sc_type="{$v.spvalue_id}" {if $k == '1'}class="sp_val"{/if} name="sp_val[{$k}][{$v.spvalue_id}]">
              </span><span sctype="pv_name">{$v.spvalue_name}</span>
          </li>
          {/foreach}
          <?php }?>
          <li data-param="{gc_id:{$goods_class.gc_id},sp_id:{$k},url:'{:url('Goodsadd/ajax_add_spec')}'}">
            <div sctype="specAdd1"><a href="javascript:void(0);" class="sc-btn" sctype="specAdd"><i class="fa fa-plus"></i>{$Think.lang.add_specification_value}</a></div>
            <div sctype="specAdd2" style="display:none;">
              <input class="text w60" type="text" placeholder="{$Think.lang.specification_value_name}" maxlength="20">
              <a href="javascript:void(0);" sctype="specAddSubmit" class="sc-btn sc-btn-acidblue ml5 mr5">{$Think.lang.sc_ok}</a><a href="javascript:void(0);" sctype="specAddCancel" class="sc-btn sc-btn-orange">{$Think.lang.sc_cancel}</a></div>
          </li>
        </ul>
        <?php if(isset($edit_goods_sign) && $k == '1'){?>
        <p class="hint">{$Think.lang.specifications_instructions3}</p>
        <?php }?>
        </dd>
        </dl>
        <?php $i++;?>
        <?php }?>
        <?php }?>
        <dl sc_type="spec_dl" class="spec-bg" style="display:none; overflow: visible;">
          <dt>{$Think.lang.srore_goods_index_goods_stock_set}{$Think.lang.sc_colon}</dt>
          <dd class="spec-dd">
            <table border="0" cellpadding="0" cellspacing="0" class="spec_table">
              <thead>
              {notempty name="spec_list"}
              <?php $spec_i=0; ?>
              {foreach name="spec_list" item="val" key="k" }
              <th sctype="spec_name_{$k}" data-type="spec_name_<?php echo $spec_i; ?>" style="display:none"><?php if (isset($goods['spec_name'][$k])) { echo $goods['spec_name'][$k];} else {echo $val['sp_name'];}?></th>
              <?php $spec_i++; ?>
              {/foreach}
              {/notempty}
              <th class="w90">{$Think.lang.goods_index_goods_no}</th>
              <th class="w90"><span class="red">*</span>{$Think.lang.market_price}
                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>
                  <div class="batch-input" style="display:none;">
                    <h6>{$Think.lang.batch_setting_price}：</h6>
                    <a href="javascript:void(0)" class="close">X</a>
                    <input name="" type="text" class="text price" />
                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="marketprice">{$Think.lang.sc_set}</a><span class="arrow"></span></div>
                </div></th>
              <th class="w90"><span class="red">*</span>{$Think.lang.goods_index_price}
                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>
                  <div class="batch-input" style="display:none;">
                    <h6>{$Think.lang.batch_setting_price}：</h6>
                    <a href="javascript:void(0)" class="close">X</a>
                    <input name="" type="text" class="text price" />
                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="price">{$Think.lang.sc_set}</a><span class="arrow"></span></div>
                </div></th>

              <!---- 代理商价格 ---->
<!--              <th class="w90">-->
<!--                  <span class="red">*</span>一级代理-->
<!--                  <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>-->
<!--                      <div class="batch-input" style="display:none;">-->
<!--                          <h6>{$Think.lang.batch_setting_price}：</h6>-->
<!--                          <a href="javascript:void(0)" class="close">X</a>-->
<!--                          <input name="" type="text" class="text price" />-->
<!--                          <a href="javascript:void(0)" class="sc-btn-mini" data-type="goods_price_1">{$Think.lang.sc_set}</a><span class="arrow"></span>-->
<!--                      </div>-->
<!--                  </div>-->
<!--              </th>-->
<!--              <th class="w90">-->
<!--                  <span class="red">*</span>二级代理-->
<!--                  <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>-->
<!--                      <div class="batch-input" style="display:none;">-->
<!--                          <h6>{$Think.lang.batch_setting_price}：</h6>-->
<!--                          <a href="javascript:void(0)" class="close">X</a>-->
<!--                          <input name="" type="text" class="text price" />-->
<!--                          <a href="javascript:void(0)" class="sc-btn-mini" data-type="goods_price_2">{$Think.lang.sc_set}</a><span class="arrow"></span>-->
<!--                      </div>-->
<!--                  </div>-->
<!--              </th>-->
<!--              <th class="w90">-->
<!--                  <span class="red">*</span>三级代理-->
<!--                  <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>-->
<!--                      <div class="batch-input" style="display:none;">-->
<!--                          <h6>{$Think.lang.batch_setting_price}：</h6>-->
<!--                          <a href="javascript:void(0)" class="close">X</a>-->
<!--                          <input name="" type="text" class="text price" />-->
<!--                          <a href="javascript:void(0)" class="sc-btn-mini" data-type="goods_price_3">{$Think.lang.sc_set}</a><span class="arrow"></span>-->
<!--                      </div>-->
<!--                  </div>-->
<!--              </th>-->

              <th class="w90"><span class="red">*</span>{$Think.lang.goods_index_stock}
                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>
                  <div class="batch-input" style="display:none;">
                    <h6>{$Think.lang.batch_setting_inventory}：</h6>
                    <a href="javascript:void(0)" class="close">X</a>
                    <input name="" type="text" class="text stock" />
                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="stock">{$Think.lang.sc_set}</a><span class="arrow"></span></div>
                </div></th>
              <th class="w90">{$Think.lang.warning_value}
                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>
                  <div class="batch-input" style="display:none;">
                    <h6>{$Think.lang.set_warning_value_batches}：</h6>
                    <a href="javascript:void(0)" class="close">X</a>
                    <input name="" type="text" class="text stock" />
                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="alarm">{$Think.lang.sc_set}</a><span class="arrow"></span></div>
                </div></th>
<!--            <div class="declare">-->
<!--              <th class="w90"><span class="red">*</span>申报单价-->
<!--                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>-->
<!--                  <div class="batch-input" style="display:none;">-->
<!--                    <h6>批量设置申报单价：</h6>-->
<!--                    <a href="javascript:void(0)" class="close">X</a>-->
<!--                    <input name="" type="text" class="text declare_price" />-->
<!--                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="declare_price">{$Think.lang.sc_set}</a><span class="arrow"></span></div>-->
<!--                </div></th>-->
<!--              <th class="w90"><span class="red">*</span>申报数量-->
<!--                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>-->
<!--                  <div class="batch-input" style="display:none;">-->
<!--                    <h6>批量设置申报数量：</h6>-->
<!--                    <a href="javascript:void(0)" class="close">X</a>-->
<!--                    <input name="" type="text" class="text declare_num" />-->
<!--                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="declare_num">{$Think.lang.sc_set}</a><span class="arrow"></span></div>-->
<!--                </div></th>-->
<!--              <th class="w90"><span class="red">*</span>毛重-->
<!--                <div class="batch"><i class="fa fa-pencil-square" title="{$Think.lang.batch_operation}"></i>-->
<!--                  <div class="batch-input" style="display:none;">-->
<!--                    <h6>批量设置毛重：</h6>-->
<!--                    <a href="javascript:void(0)" class="close">X</a>-->
<!--                    <input name="" type="text" class="text gross_weight" />-->
<!--                    <a href="javascript:void(0)" class="sc-btn-mini" data-type="gross_weight">{$Think.lang.sc_set}</a><span class="arrow"></span></div>-->
<!--                </div></th>-->
<!--            </div>-->

              </thead>
              <tbody sc_type="spec_table">
              </tbody>
            </table>
            <p class="hint">{$Think.lang.click}<i class="fa fa-pencil-square"></i>{$Think.lang.modify_value_column_batches}。</p>
          </dd>
        </dl>

<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required">*</i>{$Think.lang.goods_index_goods_stock}{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            <input name="g_storage" value="{$goods.g_storage|default=''}" type="text" class="text w60" />-->
<!--            <span></span>-->
<!--            <p class="hint">{$Think.lang.goods_index_goods_stock_help}</p>-->
<!--          </dd>-->
<!--        </dl>-->

        <dl>
          <dt sc_type="no_spec">{$Think.lang.goods_max_limit}{$Think.lang.sc_colon}</dt>
          <dd sc_type="no_spec">
            <input name="goods_max_limit" value="{$goods.goods_max_limit|default=$order_quantity_limit}" type="text" class="text w60" />
          </dd>
        </dl>
        <dl>
          <dt sc_type="no_spec">商品最小购买量{$Think.lang.sc_colon}</dt>
          <dd sc_type="no_spec">
            <input name="goods_min_limit" value="{$goods.goods_min_limit|default=1}" type="text" class="text w60" />
          </dd>
        </dl>
        <dl>
          <dt>{$Think.lang.stock_warning_value}{$Think.lang.sc_colon}</dt>
          <dd>
            <input name="g_alarm" value="{$goods.goods_storage_alarm|default=''}" type="text" class="text w60" />
            <span></span>
            <p class="hint">{$Think.lang.minimum_stock_warning_value}<br>
              {$Think.lang.fill_warning_number_value}</p>
          </dd>
        </dl>
        <dl>
          <dt sc_type="no_spec">{$Think.lang.goods_index_goods_no}{$Think.lang.sc_colon}</dt>
          <dd sc_type="no_spec">
            <p>
              <input name="g_serial" value="{$goods.goods_serial|default=''}" type="text"  class="text"  />
            </p>
            <p class="hint">{$Think.lang.goods_index_goods_no_help}</p>
          </dd>
        </dl>
        <dl>
          <dt><i class="required">*</i>{$Think.lang.goods_album_goods_pic}{$Think.lang.sc_colon}</dt>
          <dd>
            <div class="sc-goods-default-pic">
              <div class="goodspic-uplaod">
                <div class="upload-thumb"> <img sctype="goods_image" src="{:goods_thumb($goods, 240)}"/> </div>
                <input type="hidden" name="image_path" id="image_path" sctype="goods_image" value="{$goods.goods_image|default=''}" />
                <span></span>
                <p class="hint">{$Think.lang.goods_step2_description_one}<?php printf(lang('goods_step2_description_two'),intval(config('image_max_filesize'))/1024);?></p>
                <div class="handle">
                  <div class="sc-upload-btn"> <a href="javascript:void(0);">
                  <span>
                  <input type="file" hidefocus="true" size="1" class="input-file" name="goods_image" id="goods_image">
                  </span>
                    <p><i class="fa fa-upload"></i>图片上传</p>
                  </a>
                  </div>
                  <a class="sc-btn mt5" sctype="show_image" href="{:url('Goodsalbum/pic_list',['item'=>'goods'])}"><i class="fa fa-picture-o"></i>{$Think.lang.image_space_selection}</a> <a href="javascript:void(0);" sctype="del_goods_demo" class="sc-btn mt5" style="display: none;"><i class="fa fa-arrow-circle-up"></i>{$Think.lang.close_album}</a></div>
              </div>
            </div>
            <div id="demo"></div>
          </dd>
        </dl>
<!--        <div class="declare">-->
<!--        <h3 id="demo7">申报相关</h3>-->

<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> HS编码{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            <input name="hs_code" value="{$goods.hs_code|default=''}" type="text" class="text w-100" /><span></span>-->
<!--          </dd>-->
<!--        </dl>-->
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> 申报规格{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            <input name="declare_spec" value="{$goods.declare_spec|default=''}" type="text" class="text w-300" /><span></span>-->
<!--          </dd>-->
<!--        </dl>-->
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> 国家{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            {sctaglib:dcselect list=":dict_get('country',true)" id="input-country" class="w-100 sc-select-filter" name="country" value="$goods.country" default="  " /}-->
<!--          </dd>-->
<!--        </dl>-->
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> 申报单价{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            <input name="declare_price" value="{$goods.declare_price|default=''}" type="text" class="text w60" /><em class="add-on"><i class="fa fa-cny"></i></em> <span></span>-->
<!--          </dd>-->
<!--        </dl>-->
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> 申报数量{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            <input name="declare_num" value="{$goods.declare_num|default=''}" type="text" class="text w60" /><span></span>-->
<!--          </dd>-->
<!--        </dl>-->
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> 申报单位{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            {sctaglib:dcselect list=":dict_get('unit',true)" class="w-100 sc-select-filter" name="declare_unit" value="$goods.declare_unit" default="  " /}-->
<!--          </dd>-->
<!--        </dl>-->
<!--        <dl>-->
<!--          <dt sc_type="no_spec"><i class="required" aria-required="true">*</i> 毛重{$Think.lang.sc_colon}</dt>-->
<!--          <dd sc_type="no_spec">-->
<!--            <input name="gross_weight" value="{$goods.gross_weight|default=''}" type="text" class="text w60" /><span></span>-->
<!--          </dd>-->
<!--        </dl>-->
<!--        </div>-->

        <h3 id="demo2">{$Think.lang.goods_index_goods_detail_info}</h3>
        <dl style="overflow: visible;">
          <dt><i class="required">*</i>{$Think.lang.goods_index_goods_brand}{$Think.lang.sc_colon}</dt>
          <dd>
            <div class="sc-brand-select" style="z-index: 9999">
              <div class="selection">
                <input name="b_name" id="b_name" value="{$goods.brand_name|default=''}" type="text" class="text w180" readonly="readonly" />
                <input type="hidden" name="b_id" id="b_id" value="{$goods.brand_id|default=''}" />
                <em class="add-on" sctype="add-on"><i class="fa fa-toggle-down"></i></em></div>
              <div class="sc-brand-select-container">
                <div class="brand-index" data-tid="{$goods_class.type_id}" data-url="{:url('Goodsadd/ajax_get_brand')}">
                  <div class="letter" sctype="letter">
                    <ul>
                      <li><a href="javascript:void(0);" data-letter="all">{$Think.lang.sc_all}</a></li>
                      <li><a href="javascript:void(0);" data-letter="A">A</a></li>
                      <li><a href="javascript:void(0);" data-letter="B">B</a></li>
                      <li><a href="javascript:void(0);" data-letter="C">C</a></li>
                      <li><a href="javascript:void(0);" data-letter="D">D</a></li>
                      <li><a href="javascript:void(0);" data-letter="E">E</a></li>
                      <li><a href="javascript:void(0);" data-letter="F">F</a></li>
                      <li><a href="javascript:void(0);" data-letter="G">G</a></li>
                      <li><a href="javascript:void(0);" data-letter="H">H</a></li>
                      <li><a href="javascript:void(0);" data-letter="I">I</a></li>
                      <li><a href="javascript:void(0);" data-letter="J">J</a></li>
                      <li><a href="javascript:void(0);" data-letter="K">K</a></li>
                      <li><a href="javascript:void(0);" data-letter="L">L</a></li>
                      <li><a href="javascript:void(0);" data-letter="M">M</a></li>
                      <li><a href="javascript:void(0);" data-letter="N">N</a></li>
                      <li><a href="javascript:void(0);" data-letter="O">O</a></li>
                      <li><a href="javascript:void(0);" data-letter="P">P</a></li>
                      <li><a href="javascript:void(0);" data-letter="Q">Q</a></li>
                      <li><a href="javascript:void(0);" data-letter="R">R</a></li>
                      <li><a href="javascript:void(0);" data-letter="S">S</a></li>
                      <li><a href="javascript:void(0);" data-letter="T">T</a></li>
                      <li><a href="javascript:void(0);" data-letter="U">U</a></li>
                      <li><a href="javascript:void(0);" data-letter="V">V</a></li>
                      <li><a href="javascript:void(0);" data-letter="W">W</a></li>
                      <li><a href="javascript:void(0);" data-letter="X">X</a></li>
                      <li><a href="javascript:void(0);" data-letter="Y">Y</a></li>
                      <li><a href="javascript:void(0);" data-letter="Z">Z</a></li>
                      <li><a href="javascript:void(0);" data-letter="0-9">其他</a></li>
                      <li><a href="javascript:void(0);" data-empty="0">{$Think.lang.goodsadd_empty}</a></li>
                    </ul>
                  </div>
                  <div class="search" sctype="search">
                    <input name="search_brand_keyword" id="search_brand_keyword" type="text" class="text" placeholder="{$Think.lang.brand_name_keyword_search}"/><a href="javascript:void(0);" class="sc-btn-mini" style="vertical-align: top;">Go</a></div>
                </div>
                <div class="brand-list" sctype="brandList">
                  <ul sctype="brand_list">
                    {notempty name="brand_list"}
                    {foreach name="brand_list" item="val"}
                    <li data-id='{$val.brand_id}'data-name='{$val.brand_name}'><em>{$val.brand_initial}</em>{$val.brand_name}</li>
                    {/foreach}
                    {/notempty}
                  </ul>
                </div>
                <div class="no-result" sctype="noBrandList" style="display: none;">{$Think.lang.does_not_match}"<strong>{$Think.lang.search_keywords}</strong>"{$Think.lang.conditional_brand}</div>
              </div>
            </div>
          </dd>
        </dl>
        <!--商品属性-->
        {notempty name="attr_list"}
        <dl>
          <dt>{$Think.lang.goods_index_goods_attr}{$Think.lang.sc_colon}</dt>
          <dd>
            {foreach name="attr_list" item="val" key="k" }
            <div class="inline-block-area w-240 m-5 text-right">
                <label class="mr5">{$val.attr_name}：</label>
                <input type="hidden" name="attr[{$k}][name]" value="{$val.attr_name}" />
                    {php}$attrvalue_name = '';{/php}
                {notempty name="val"}
                    {foreach name="$val.value" item="v"}
                    {if isset($attr_checked) && in_array($v['attrvalue_id'], $attr_checked)}
                    {php}$attrvalue_name = $v['attrvalue_name'];{/php}
                    {/if}
                    {/foreach}
                {/notempty}
                <input type="text" name="attr[{$k}][value]" value="{$attrvalue_name}">
            </div>
            {/foreach}
          </dd>
        </dl>
        {/notempty}
        <dl>
          <dt>{$Think.lang.goods_index_goods_desc}{$Think.lang.sc_colon}</dt>
          <dd id="dsProductDetails">
            <div class="tabs">
              <ul class="ui-tabs-nav">
                <li class="ui-tabs-selected"><a href="#panel-1"><i class="fa fa-desktop"></i> {$Think.lang.computer_side}</a></li>
                <li class="selected"><a href="#panel-2"><i class="fa fa-mobile-phone"></i>{$Think.lang.mobile_side}</a></li>
              </ul>
              <div id="panel-1" class="ui-tabs-panel">
                {:build_editor(['name'=>'goods_body','content'=>$goods.goods_body?htmlspecialchars_decode($goods.goods_body):''])}
                <textarea name="goods_body" id="goods_body"></textarea>
                <div class="hr8 m-tb-10">

                  <a class="sc-btn mt5" sctype="show_desc" href="{:url('Goodsalbum/pic_list',['item'=>'des'])}"><i class="fa fa-picture-o"></i>{$Think.lang.goods_album_insert_users_photo}</a> <a href="javascript:void(0);" sctype="del_desc" class="sc-btn mt5" style="display: none;"><i class=" fa fa-arrow-circle-up"></i>{$Think.lang.close_album}</a>
                </div>
                <p id="des_demo"></p>
              </div>
              <div id="panel-2" class="ui-tabs-panel ui-tabs-hide">
                <div class="sc-mobile-editor">
                  <div class="pannel">
                    <div class="size-tip"><span sctype="img_count_tip">{$Think.lang.picture_number_than}<em>20</em>{$Think.lang.goodsadd_sheet}</span><i>|</i><span sctype="txt_count_tip">{$Think.lang.words_must_not_exceed}<em>5000</em>{$Think.lang.goodsadd_words}</span></div>
                    <div class="control-panel" sctype="mobile_pannel">
                      {notempty name="$goods.mb_body"}
                      {foreach name="$goods.mb_body" item="val" }
                      {if $val.type == 'text'}
                      <div class="module m-text">
                        <div class="tools"><a sctype="mp_up" href="javascript:void(0);">{$Think.lang.goodsadd_up}</a><a sctype="mp_down" href="javascript:void(0);">{$Think.lang.goodsadd_down}</a><a sctype="mp_edit" href="javascript:void(0);">{$Think.lang.sc_edit}</a><a sctype="mp_del" href="javascript:void(0);">{$Think.lang.sc_del}</a></div>
                        <div class="content">
                          <div class="text-div">{$val.value}</div>
                        </div>
                        <div class="cover"></div>
                      </div>
                      {/if}
                      {if $val.type == 'image'}
                      <div class="module m-image">
                        <div class="tools"><a sctype="mp_up" href="javascript:void(0);">{$Think.lang.goodsadd_up}</a><a sctype="mp_down" href="javascript:void(0);">{$Think.lang.goodsadd_down}</a><a sctype="mp_rpl" href="javascript:void(0);">{$Think.lang.goodsadd_replace}</a><a sctype="mp_del" href="javascript:void(0);">{$Think.lang.sc_del}</a></div>
                        <div class="content">
                          <div class="image-div"><img src="{$val.value}"></div>
                        </div>
                        <div class="cover"></div>
                      </div>
                      {/if}
                      {/foreach}
                      {/notempty}
                    </div>
                    <div class="add-btn">
                      <ul class="btn-wrap">
                        <li><a href="javascript:void(0);" sctype="mb_add_img"><i class="fa fa-picture-o"></i>
                          <p>{$Think.lang.goodsadd_picture}</p>
                        </a></li>
                        <li><a href="javascript:void(0);" sctype="mb_add_txt"><i class="fa fa-font"></i>
                          <p>{$Think.lang.goodsadd_text}</p>
                        </a></li>
                      </ul>
                    </div>
                  </div>
                  <div class="explain">
                    <dl>
                      <dt>{$Think.lang.request_information1}</dt>
                      <dd>{$Think.lang.request_information2}</dd>
                      <dd>{$Think.lang.request_information3}</dd>
                    </dl><dl>
                    <dt>{$Think.lang.request_information4}</dt>
                    <dd>{$Think.lang.request_information5}</dd>
                    <dd>{$Think.lang.request_information6}</dd>
                    <dd>{$Think.lang.request_information7}</dd>
                  </dl><dl>
                    <dt>{$Think.lang.request_information8}</dt>
                    <dd>{$Think.lang.request_information9}</dd>
                    <dd>{$Think.lang.request_information10}</dd>
                    <dd>{$Think.lang.request_information11}</dd>
                    <dd>{$Think.lang.request_information12}</dd>
                  </dl>
                  </div>
                </div>
                <div class="sc-mobile-edit-area" sctype="mobile_editor_area">
                  <div sctype="mea_img" class="sc-mea-img" style="display: none;"></div>
                  <div class="sc-mea-text" sctype="mea_txt" style="display: none;">
                    <p id="meat_content_count" class="text-tip"></p>
                    <textarea class="textarea valid" sctype="meat_content"></textarea>
                    <div class="button"><a class="sc-btn sc-btn-blue" sctype="meat_submit" href="javascript:void(0);">确认</a><a class="sc-btn ml10" sctype="meat_cancel" href="javascript:void(0);">{$Think.lang.sc_cancel}</a></div>
                    <a class="text-close" sctype="meat_cancel" href="javascript:void(0);">X</a>
                  </div>
                </div>
                <input name="m_body" autocomplete="off" type="hidden" value='{$goods.mobile_body|default=''}'>
              </div>
              <div class="sc-upload-btn m-lr-20 m-b-20"> <a href="javascript:void(0);"><span>
                  <input type="file" hidefocus="true" size="1" class="input-file" name="add_album" id="add_album" multiple="multiple">
                  </span>
                <p><i class="fa fa-upload" data_type="0" sctype="add_album_i"></i>{$Think.lang.goods_img_upload}</p>
              </a>
              </div>
            </div>
          </dd>
        </dl>
        <h3 id="demo3">{$Think.lang.special_goods}</h3>
        <!-- 只有可发布虚拟商品才会显示 S -->
        {if $goods_class.gc_virtual == 1}
        <dl class="special-01">
          <dt>{$Think.lang.virtual_goods}{$Think.lang.sc_colon}</dt>
          <dd>
            <ul class="sc-form-radio-list">
              <li>
                <input type="radio" name="is_gv" value="1" id="is_gv_1" <?php if (isset($goods['is_virtual']) && $goods['is_virtual'] == 1) {?>checked<?php }?>>
                <label for="is_gv_1">{$Think.lang.sc_yes}</label>
              </li>
              <li>
                <input type="radio" name="is_gv" value="0" id="is_gv_0" <?php if ($goods['is_virtual'] == 0) {?>checked<?php }?>>
                <label for="is_gv_0">{$Think.lang.sc_no}</label>
              </li>
            </ul>
            <p class="hint vital">{$Think.lang.virtual_goods_instructions1}</p>
          </dd>
        </dl>
        <dl class="special-01" sctype="virtual_valid" <?php if ($goods['is_virtual'] == 0) {?>style="display:none;"<?php }?>>
        <dt><i class="required">*</i>{$Think.lang.virtual_goods_instructions2}{$Think.lang.sc_colon}</dt>
        <dd>
          <input type="text" name="g_vindate" id="g_vindate" class="w80 text" value="<?php if($goods['is_virtual'] == 1 && !empty($goods['virtual_indate'])) { echo date('Y-m-d', $goods['virtual_indate']);}?>"><em class="add-on"><i class="fa fa-calendar"></i></em>
          <span></span>
          <p class="hint">{$Think.lang.virtual_goods_instructions3}</p>
        </dd>
        </dl>
        <dl class="special-01" sctype="virtual_valid" <?php if ($goods['is_virtual'] == 0) {?>style="display:none;"<?php }?>>
        <dt><i class="required">*</i>{$Think.lang.virtual_goods_instructions4}{$Think.lang.sc_colon}</dt>
        <dd>
          <input type="text" name="g_vlimit" id="g_vlimit" class="w80 text" value="<?php if ($goods['is_virtual'] == 1) {echo $goods['virtual_limit'];}?>">
          <span></span>
          <p class="hint">{$Think.lang.virtual_goods_instructions5}</p>
        </dd>
        </dl>
        <dl class="special-01" sctype="virtual_valid" <?php if ($goods['is_virtual'] == 0) {?>style="display:none;"<?php }?>>
        <dt>{$Think.lang.virtual_goods_instructions6}{$Think.lang.sc_colon}</dt>
        <dd>
          <ul class="sc-form-radio-list">
            <li>
              <input type="radio" name="g_vinvalidrefund" id="g_vinvalidrefund_1" value="1" <?php if ($goods['virtual_invalid_refund'] ==1) {?>checked<?php }?>>
              <label for="g_vinvalidrefund_1">{$Think.lang.sc_yes}</label>
            </li>
            <li>
              <input type="radio" name="g_vinvalidrefund" id="g_vinvalidrefund_0" value="0" <?php if ($goods['virtual_invalid_refund'] == 0) {?>checked<?php }?>>
              <label for="g_vinvalidrefund_0">{$Think.lang.sc_no}</label>
            </li>
          </ul>
          <p class="hint">{$Think.lang.virtual_goods_instructions7}</p>
        </dd>
        </dl>
        {/if}
        <!-- 只有可发布虚拟商品才会显示 E -->
        <!-- F码商品专有项 S -->
        <!--<dl class="special-02" sctype="virtual_null" <?php if (isset($goods['is_virtual']) && $goods['is_virtual'] == 1) {?>style="display:none;"<?php }?>>-->
        <!--<dt>{$Think.lang.f_code_goods}{$Think.lang.sc_colon}</dt>-->
        <!--<dd>-->
          <!--<ul class="sc-form-radio-list">-->
            <!--<li>-->
              <!--<input type="radio" name="is_fc" id="is_goodsfcode_1" value="1" <?php if (isset($goods['is_goodsfcode']) && $goods['is_goodsfcode'] == 1) {?>checked<?php }?>>-->
              <!--<label for="is_goodsfcode_1">{$Think.lang.sc_yes}</label>-->
            <!--</li>-->
            <!--<li>-->
              <!--<input type="radio" name="is_fc" id="is_goodsfcode_0" value="0" <?php if (isset($goods['is_goodsfcode']) && $goods['is_goodsfcode'] == 0) {?>checked<?php }?>>-->
              <!--<label for="is_goodsfcode_0">{$Think.lang.sc_no}</label>-->
            <!--</li>-->
          <!--</ul>-->
          <!--<p class="hint vital">{$Think.lang.f_code_guidelines1}</p>-->
        <!--</dd>-->
        <!--</dl>-->
        <!--<dl class="special-02" sctype="fcode_valid" <?php if (isset($goods['is_goodsfcode']) && $goods['is_goodsfcode'] == 0) {?>style="display:none;"<?php }?>>-->
        <!--<dt>-->
          <!--{if !isset($edit_goods_sign)}-->
          <!--<i class="required">*</i>-->
          <!--{/if}-->
          <!--{$Think.lang.f_code_guidelines2}{$Think.lang.sc_colon}</dt>-->
        <!--<dd>-->
          <!--<input type="text" name="g_fccount" id="g_fccount" class="w80 text" value="">-->
          <!--<span></span>-->
          <!--<p class="hint">{$Think.lang.f_code_guidelines3}</p>-->
        <!--</dd>-->
        <!--</dl>-->
        <!--<dl class="special-02" sctype="fcode_valid" <?php if (isset($goods['is_goodsfcode']) && $goods['is_goodsfcode'] == 0) {?>style="display:none;"<?php }?>>-->
        <!--<dt>-->
          <!--{if !isset($edit_goods_sign)}-->
          <!--<i class="required">*</i>-->
          <!--{/if}-->
          <!--{$Think.lang.f_code_guidelines4}{$Think.lang.sc_colon}</dt>-->
        <!--<dd>-->
          <!--<input type="text" name="g_fcprefix" id="g_fcprefix" class="w80 text" value="">-->
          <!--<span></span>-->
          <!--<p class="hint">{$Think.lang.f_code_guidelines5}</p>-->
        <!--</dd>-->
        <!--</dl>-->
        <!--<?php if (isset($goods['is_goodsfcode']) && $goods['is_goodsfcode'] == 1) {?>-->
        <!--<dl class="special-02" sctype="fcode_valid">-->
          <!--<dt>-->
            <!--<a class="sc-btn-mini sc-btn-red" href="{:url('Goods/download_f_code_excel',['commonid'=>$goods.goods_commonid])}">{$Think.lang.download_code_f}</a>&nbsp;&nbsp;{$Think.lang.goodsadd_f_code}{$Think.lang.sc_colon}</dt>-->
          <!--<dd>-->
            <!--<ul class="sc-form-radio-list">-->
              <!--{notempty name="fcode_array"}-->
              <!--{foreach name="fcode_array" item="val" }-->
              <!--<li>-->
                <!--{$val.goodsfcode_code}({if $val.goodsfcode_state == 1}{$Think.lang.goodsadd_employ}{else /}{$Think.lang.goodsadd_unused}{/if})-->
              <!--</li>-->
              <!--{/foreach}-->
              <!--{/notempty}-->
            <!--</ul>-->
          <!--</dd>-->
        <!--</dl>-->
        <!--<?php }?>-->
        <!-- F码商品专有项 E -->
        <!-- 预售商品 S -->
        <dl class="special-03" sctype="virtual_null" <?php if (isset($goods['is_virtual']) && $goods['is_virtual'] == 1) {?>style="display:none;"<?php }?>>
        <dt>{$Think.lang.goodsadd_presell}{$Think.lang.sc_colon}</dt>
        <dd>
          <ul class="sc-form-radio-list">
            <li>
              <input type="radio" name="is_presell" id="is_presell_1" value="1" <?php if(isset($goods['is_presell']) && $goods['is_presell'] == 1) {?>checked<?php }?>>
              <label for="is_presell_1">{$Think.lang.sc_yes}</label>
            </li>
            <li>
              <input type="radio" name="is_presell" id="is_presell_0" value="0" <?php if(isset($goods['is_presell']) && $goods['is_presell'] == 0) {?>checked<?php }?>>
              <label for="is_presell_0">{$Think.lang.sc_no}</label>
            </li>
          </ul>
          <p class="hint vital">{$Think.lang.booking_information}</p>
        </dd>
        </dl>
        <dl class="special-03" sctype="is_presell" <?php if (isset($goods['is_presell']) && $goods['is_presell'] == 0) {?>style="display:none;"<?php }?>>
        <dt><i class="required">*</i>{$Think.lang.delivery_date}{$Think.lang.sc_colon}</dt>
        <dd>
          <input type="text" name="g_deliverdate" id="g_deliverdate" class="w80 text" value="<?php if (isset($goods['presell_deliverdate']) && $goods['presell_deliverdate'] > 0) {echo date('Y-m-d', $goods['presell_deliverdate']);}?>"><em class="add-on"><i class="fa fa-calendar"></i></em>
          <span></span>
          <p class="hint">{$Think.lang.ship_time}。</p>
        </dd>
        </dl>
        <!-- 预售商品 E -->
        <!-- 商品物流信息 S -->
        <h3 id="demo4">{$Think.lang.goods_index_goods_transport}</h3>
        <dl>
          <dt>{$Think.lang.goods_index_goods_szd}{$Think.lang.sc_colon}</dt>
          <dd>
            <input type="hidden" value="<?php echo $goods['areaid_2'] ? $goods['areaid_2'] : $goods['areaid_1'];?>" name="region" id="region">
            <input type="hidden" value="{$goods.areaid_1|default=''}" name="province_id" id="_area_1">
            <input type="hidden" value="{$goods.areaid_2|default=''}" name="city_id" id="_area_2">
            </p>
          </dd>
        </dl>
        <dl sctype="virtual_null" {if $goods.is_virtual == 1}style="display:none;"{/if}>
        <dt>{$Think.lang.order_total_transport}{$Think.lang.sc_colon}</dt>
        <dd>
          <ul class="sc-form-radio-list">
            <li>
              <input id="freight_0" sctype="freight" name="freight" class="radio" type="radio" <?php if (intval($goods['transport_id']) == 0) {?>checked="checked"<?php }?> value="0">
              <label for="freight_0">{$Think.lang.fixed_freight}</label>
              <div sctype="div_freight" <?php if (intval($goods['transport_id']) != 0) {?>style="display: none;"<?php }?>>
              <input id="g_freight" class="w50 text" sc_type='transport' type="text" value="<?php printf('%.2f', floatval($goods['goods_freight']));?>" name="g_freight"><em class="add-on"><i class="fa fa-cny"></i></em> </div>
      </li>
      <li>
        <input id="freight_1" sctype="freight" name="freight" class="radio" type="radio" <?php if (intval($goods['transport_id']) != 0) {?>checked="checked"<?php }?> value="1">
        <label for="freight_1">{$Think.lang.goods_index_use_tpl}</label>
        <div sctype="div_freight" <?php if (intval($goods['transport_id']) == 0) {?>style="display: none;"<?php }?>>
        <input id="transport_id" type="hidden" value="{$goods.transport_id}" name="transport_id">
        <input id="transport_title" type="hidden" value="{$goods.transport_title}" name="transport_title">
        <span id="postageName" class="transport-name" <?php if ($goods['transport_title'] != '' && intval($goods['transport_id'])) {?>style="display: inline-block;"<?php }?>>{$goods.transport_title}</span>
        <a href="JavaScript:void(0);" onclick="window.open('{:url('Transport/index',['type'=>'select'])}')" class="dsbtn" id="postageButton"><i class="fa fa-truck"></i>{$Think.lang.goods_index_select_tpl}</a>
  </div>
  </li>
  </ul>
  <p class="hint"> {$Think.lang.freight_set}</p>
  </dd>
  </dl>
  <!-- 商品物流信息 E -->
  <h3 id="demo5" sctype="virtual_null" <?php if ($goods['is_virtual'] == 1) {?>style="display:none;"<?php }?>>{$Think.lang.invoice_information}</h3>
  <dl sctype="virtual_null" <?php if ($goods['is_virtual'] == 1) {?>style="display:none;"<?php }?>>
  <dt>{$Think.lang.whether_add_tax_invoice}：</dt>
  <dd>
    <ul class="sc-form-radio-list">
      <li>
        <label>
          <input name="g_vat" value="1" <?php if (!empty($goods) && $goods['goods_vat'] == 1) { ?>checked="checked" <?php } ?> type="radio" />
          {$Think.lang.sc_yes}</label>
      </li>
      <li>
        <label>
          <input name="g_vat" value="0" <?php if (empty($goods) || $goods['goods_vat'] == 0) { ?>checked="checked" <?php } ?> type="radio"/>
          {$Think.lang.sc_no}</label>
      </li>
    </ul>
    <p class="hint"></p>
  </dd>
  </dl>
  <dl>
    <dt>{$Think.lang.goods_index_goods_show}{$Think.lang.sc_colon}</dt>
    <dd>
      <ul class="sc-form-radio-list">
        <li>
          <label>
            <input name="g_state" value="1" type="radio" <?php if (empty($goods) || $goods['goods_state'] == 1 || $goods['goods_state'] == 10) {?>checked="checked"<?php }?> />
            {$Think.lang.goods_index_immediately_sales}</label>
        </li>
        <li>
          <label>
            <input name="g_state" value="0" type="radio" sctype="auto" />
            {$Think.lang.goods_step2_start_time}
          </label>
          <input type="text" class="w80 text" name="starttime" disabled="disabled" style="background:#E7E7E7 none;" id="starttime" value="{:date('Y-m-d')}" />
          <select disabled="disabled" style="background:#E7E7E7 none;" name="starttime_H" id="starttime_H">
            {foreach name="hour_array" item="val" }
            <option value="{$val}" <?php $sign_h = 0;if($val>=date('h') && $sign_h != 1){?>selected="selected"<?php $sign_H = 1;}?>>{$val}</option>
            {/foreach}
          </select>
          {$Think.lang.goods_step2_hour}
          <select disabled="disabled" style="background:#E7E7E7 none;" name="starttime_i" id="starttime_i">
            {foreach name="minute_array" item="val"}
            <option value="{$val}" <?php $sign_mi = 0;if($val>=date('i') && $sign_mi != 1){?>selected="selected"<?php $sign_mi = 1;}?>>{$val}</option>
            {/foreach}
          </select>
          {$Think.lang.goods_step2_minute}</li>
        <li>
          <label>
            <input name="g_state" value="0" type="radio" <?php if (!empty($goods) && $goods['goods_state'] == 0) {?>checked="checked"<?php }?> />
            {$Think.lang.goods_index_in_warehouse} </label>
        </li>
      </ul>
    </dd>
  </dl>
  <dl>
    <dt>{$Think.lang.goodsadd_make}{$Think.lang.sc_colon}</dt>
    <dd>
      <ul class="sc-form-radio-list">
        <li>
          <input type="radio" name="is_appoint" id="is_appoint_1" value="1"  <?php if($goods['is_appoint'] == 1) {?>checked<?php }?>>
          <label for="is_appoint_1">{$Think.lang.sc_yes}</label>
        </li>
        <li>
          <input type="radio" name="is_appoint" id="is_appoint_0" value="0"  <?php if($goods['is_appoint'] == 0) {?>checked<?php }?>>
          <label for="is_appoint_0">{$Think.lang.sc_no}</label>
        </li>
      </ul>
      <p class="hint">{$Think.lang.booking_information}</p>
    </dd>
  </dl>
  <dl sctype="is_appoint"  <?php if ($goods['is_appoint'] == 0) {?>style="display:none;"<?php }?>>
  <dt><i class="required">*</i>{$Think.lang.release_date}{$Think.lang.sc_colon}</dt>
  <dd>
    <input type="text" name="g_saledate" id="g_saledate" class="w80 text" value="<?php if ($goods['appoint_satedate'] > 0) {echo date('Y-m-d', $goods['appoint_satedate']);}?>">
    <span></span>
    <p class="hint">{$Think.lang.booking_goods}</p>
  </dd>
  </dl>
  <dl>
    <dt>{$Think.lang.goods_index_goods_recommend}{$Think.lang.sc_colon}</dt>
    <dd>
      <ul class="sc-form-radio-list">
        <li>
          <label>
            <input name="g_commend" value="1" <?php if ( $goods['goods_commend'] == 1) { ?>checked="checked" <?php } ?> type="radio" />
            {$Think.lang.sc_yes}</label>
        </li>
        <li>
          <label>
            <input name="g_commend" value="0" <?php if ( $goods['goods_commend'] == 0) { ?>checked="checked" <?php } ?> type="radio"/>
            {$Think.lang.sc_no}</label>
        </li>
      </ul>
      <p class="hint">{$Think.lang.goods_index_recommend_tip}</p>
    </dd>
  </dl>

</div>
<div class="bottom tc hr32">
  <input type="submit" class="btn" value="<?php if (isset($edit_goods_sign)) {echo lang('sc_submit');} else {?>{$Think.lang.goods_add_next}，{$Think.lang.goods_index_upload_goods_pic}<?php }?>" />
</div>
</form>
</div>


<script src="{$Think.PLUGINS_SITE_ROOT}/jquery.ajaxContent.pack.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/js/fileupload/jquery.iframe-transport.js" charset="utf-8"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/js/fileupload/jquery.ui.widget.js" charset="utf-8"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/js/fileupload/jquery.fileupload.js" charset="utf-8"></script>

<script src="{$Think.PLUGINS_SITE_ROOT}/jquery.mousewheel.js"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/jquery.charCount.js"></script>


<!--[if lt IE 8]>
<script src="{$Think.BASE_SITE_ROOT}/js/json2.js"></script>
<![endif]-->
<script src="{$Think.ADMIN_SITE_ROOT}/js/goods_add_step2.js"></script>


<script type="text/javascript">
  var DEFAULT_GOODS_IMAGE = "{:goods_thumb(array(), 60)}";
  var val = $('input[name="trade_mode"]:checked').val();
  if(val ==1){
    $('.declare').css('display','none');
  }
  $('.trade_mode').change(function () {
    val = $('input[name="trade_mode"]:checked').val();
    if(val ==1){
      $('.declare').css('display','none');
    }else{
      $('.declare').css('display','block');
  }
  });
  $(function(){
    $("#region").sc_region({show_deep:2,tip_type:1});
    //电脑端手机端tab切换
    $(".tabs").tabs();
    $.validator.addMethod('checkPrice', function(value,element){
      _g_price = parseFloat($('input[name="g_price"]').val());
      _g_marketprice = parseFloat($('input[name="g_marketprice"]').val());
      if (_g_price > _g_marketprice) {
        return false;
      }else {
        return true;
      }
    }, '<i class="fa fa-exclamation-circle"></i>{$Think.lang.not_higher_than}');
    jQuery.validator.addMethod("checkFCodePrefix", function(value, element) {
      return this.optional(element) || /^[a-zA-Z]+$/.test(value);
    },'<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information1}');
    $('#goods_form').validate({
      errorPlacement: function(error, element){
        $(element).nextAll('span').append(error);
      },
    //方便测试一下可进行删除
    <?php if (isset($edit_goods_sign)) {?>
      submitHandler:function(form){
        sc_ajaxpost('goods_form', 'url', '{:url('goods/index')}');
      },
    <?php }?>
    rules : {
      g_name : {
        required    : true,
                minlength   : 3,
                maxlength   : 50
      },
      g_jingle : {
        maxlength   : 140
      },
      g_price : {
        required    : true,
                number      : true,
                min         : 0.01,
                max         : 9999999,
                checkPrice  : true
      },
      g_marketprice : {
        required    : true,
                number      : true,
                min         : 0.01,
                max         : 9999999
      },
      g_costprice : {
        number      : true,
                min         : 0.00,
                max         : 9999999
      },
      g_storage  : {
        required    : true,
                digits      : true,
                min         : 0,
                max         : 999999999
      },
      image_path : {
        required    : true
      },
      g_vindate : {
        required    : function() {if ($("#is_gv_1").prop("checked")) {return true;} else {return false;}}
      },
      g_vlimit : {
        required	: function() {if ($("#is_gv_1").prop("checked")) {return true;} else {return false;}},
        range		: [1,10]
      },
      g_fccount : {
      <?php if (!isset($edit_goods_sign)) {?>required	: function() {if ($("#is_goodsfcode_1").prop("checked")) {return true;} else {return false;}},<?php }?>
        range		: [1,100]
      },
      g_fcprefix : {
      <?php if (!isset($edit_goods_sign)) {?>required	: function() {if ($("#is_goodsfcode_1").prop("checked")) {return true;} else {return false;}},<?php }?>
        checkFCodePrefix : true,
                rangelength	: [3,5]
      },
      g_saledate : {
        required	: function () {if ($('#is_appoint_1').prop("checked")) {return true;} else {return false;}}
      },
      g_deliverdate : {
        required	: function () {if ($('#is_presell_1').prop("checked")) {return true;} else {return false;}}
      },
      b_name : {
        required    : true
      },

    },
    messages : {
      g_name  : {
        required    : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_name_null}',
                minlength   : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_name_help}',
                maxlength   : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_name_help}'
      },
      g_jingle : {
        maxlength   : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information2}'
      },
      g_price : {
        required    : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_price_null}',
                number      : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_price_error}',
                min         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_price_interval}',
                max         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_price_interval}'
      },
      g_marketprice : {
        required    : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information3}',
                number      : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information4}',
                min         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}0.01~9999999{$Think.lang.prompt_information6}',
                max         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}0.01~9999999{$Think.lang.prompt_information6}'
      },
      g_costprice : {
        number      : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information4}',
                min         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}0.00~9999999{$Think.lang.prompt_information6}',
                max         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}0.00~9999999{$Think.lang.prompt_information6}'
      },
      g_storage : {
        required    : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_stock_null}',
                digits      : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_stock_error}',
                min         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_stock_checking}',
                max         : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_index_goods_stock_checking}'
      },
      image_path : {
        required    : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information8}'
      },
      g_vindate : {
        required    : '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information9}'
      },
      g_vlimit : {
        required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}1~10{$Think.lang.prompt_information6}',
                range		: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}1~10{$Think.lang.prompt_information6}'
      },
      g_fccount : {
        required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}1~100{$Think.lang.prompt_information6}',
                range		: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}1~100{$Think.lang.prompt_information6}'
      },
      g_fcprefix : {
        required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}3~5{$Think.lang.prompt_information7}',
                rangelength	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information5}3~5{$Think.lang.prompt_information7}'
      },
      g_saledate : {
        required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information9}'
      },
      g_deliverdate : {
        required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.prompt_information9}'
      },
      b_name : {
        required	: '<i class="fa fa-exclamation-circle"></i>品牌必填'
      },
      // hs_code : {
      //   required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_hs_code}'
      // },
      // declare_price : {
      //   required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_declare_price}'
      // },
      //   declare_num : {
      //       required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_declare_num}'
      //   },
      //   declare_spec : {
      //       required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_declare_spec}'
      //   },
      // gross_weight : {
      //   required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_gross_weight}'
      // },
      // country : {
      //   required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_declare_unit}'
      // },
      // declare_unit : {
      //   required	: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.goods_country}'
      // }
    }
  });
  <?php if (isset($goods)) {?>
      setTimeout("setArea(<?php echo $goods['areaid_1'];?>, <?php echo $goods['areaid_2'];?>)", 1000);
    <?php }?>
  });
  // 按规格存储规格值数据
  var spec_group_checked = new Array();
  <?php for($i=0; $i<$sign_i; $i++){ ?>
    spec_group_checked["<?php echo $i;?>"]='';
  <?php } ?>
  var str = '';
  var V = new Array();

  <?php for ($i=0; $i<$sign_i; $i++){?>
    var spec_group_checked_<?php echo $i;?> = new Array();
  <?php }?>

  $(function(){
    $('dl[sctype="spec_group_dl"]').on('click', 'span[sctype="input_checkbox"] > input[type="checkbox"]',function(){
      into_array();
      goods_stock_set();
    });

    // 提交后不没有填写的价格或库存的库存配置设为默认价格和0
    // 库存配置隐藏式 里面的input加上disable属性
    $('input[type="submit"]').click(function(){
      val = $('input[name="trade_mode"]:checked').val();
      $('input[data_type="price"]').each(function(){
        if($(this).val() == ''){
          $(this).val($('input[name="g_price"]').val());
        }
      });
      $('input[data_type="stock"]').each(function(){
        if($(this).val() == ''){
          $(this).val('0');
        }
      });
      $('input[data_type="alarm"]').each(function(){
        if($(this).val() == ''){
          $(this).val('0');
        }
      });
      if(val >1 ){
      $('input[data_type="declare_price"]').each(function(){
              if($(this).val() == ''){
                $(this).val('0');
              }
            });
            $('input[data_type="declare_num"]').each(function(){
              if($(this).val() == ''){
                $(this).val('0');
              }
            });
            $('input[data_type="gross_weight"]').each(function(){
              if($(this).val() == ''){
                $(this).val('0');
              }
            });
      }

      if($('dl[sc_type="spec_dl"]').css('display') == 'none'){
        $('dl[sc_type="spec_dl"]').find('input').prop('disabled','disabled');
      };


    });

  });

  // 将选中的规格放入数组
  function into_array(){
  <?php for ($i=0; $i<$sign_i; $i++){?>

      spec_group_checked_<?php echo $i;?> = new Array();
      $('dl[sc_type="spec_group_dl_<?php echo $i;?>"]').find('input[type="checkbox"]:checked').each(function(){
        i = $(this).attr('sc_type');
        v = $(this).val();
        c = null;
        if ($(this).parents('dl:first').attr('spec_img') == 't') {
          c = 1;
        }
        spec_group_checked_<?php echo $i;?>[spec_group_checked_<?php echo $i;?>.length] = [v,i,c];
      });

      spec_group_checked["<?php echo $i;?>"] = spec_group_checked_<?php echo $i;?>;

    <?php }?>
  }

  // 生成库存配置
  function goods_stock_set(){
    //  店铺价格 商品库存改为只读
    $('input[name="g_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
    $('input[name="g_storage"]').attr('readonly','readonly').css('background','#E7E7E7 none');
    $('input[name="declare_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
    $('input[name="declare_num"]').attr('readonly','readonly').css('background','#E7E7E7 none');
    $('input[name="gross_weight"]').attr('readonly','readonly').css('background','#E7E7E7 none');

    $('dl[sc_type="spec_dl"]').show();
    str = '<tr>';
  <?php recursionSpec(0,$sign_i);?>
    //生成字符串开始

    var total_length=0;
    for(var i in checked_group){
      $('[data-type=spec_name_'+(i)+']').show();
      if(total_length==0){
        total_length=1;
      }
      total_length=total_length*spec_group_checked[checked_group[i]].length;
    }

    var k=new Array();
    var l=0;
    var n=0;
    for(var j=0;j<total_length;j++){
      var spec_bunch='i_';
      var sub_str='';
      sub_str += '<input type="hidden" name="spec[spec_bunch][goods_id]" sc_type="spec_bunch|id" value="" />';
      for(var i in checked_group){


        if(typeof(k[checked_group[i]])=='undefined'){
          k[checked_group[i]]=0;
        }
        spec_bunch+=spec_group_checked[checked_group[i]][k[checked_group[i]]][1];
        if (spec_group_checked[checked_group[i]][k[checked_group[i]]][2] != null) { sub_str += '<input type="hidden" name="spec[spec_bunch][color]" value="'+spec_group_checked[checked_group[i]][k[checked_group[i]]][1]+'" />';}
        sub_str +='<td><input type="hidden" name="spec[spec_bunch][sp_value]['+spec_group_checked[checked_group[i]][k[checked_group[i]]][1]+']" value="'+spec_group_checked[checked_group[i]][k[checked_group[i]]][0]+'" />'+spec_group_checked[checked_group[i]][k[checked_group[i]]][0]+'</td>';
        //checked_group存储选中的规格的键
        //spec_group_checked存储选中的规格的值
        //k表示规格值的指针
        //total_length表示选中规格的总长度

        //由最后一个规格开始遍历，如果满了，则前面的规格指针增加，同时当前指针指置0

        //最后一个规格项
        //最后规格的指针增加
        //最后一个规格的指针满了
        //从最后的规格开始向前遍历
        //如果规格指针没有满
        //规格指针增加
        //规格指针复位
        if(i==(checked_group.length-1)){
          k[checked_group[i]]++;
          if(k[checked_group[i]]==spec_group_checked[checked_group[i]].length){
            for(var m = (checked_group.length-1);m>=0;m--){
              if(k[checked_group[m]]<(spec_group_checked[checked_group[m]].length-1)){
                k[checked_group[m]]++;
                break;
              }else{
                k[checked_group[m]]=0;
              }
            }
          }
        }
      }

      if($('input[name="trade_mode"]:checked').val() >1){
        sub_str +='<td><input class="text sku" type="text" name="spec[spec_bunch][sku]" sc_type="spec_bunch|sku" value="" /></td>' +
            '<td><input class="text price" type="text" name="spec[spec_bunch][marketprice]" data_type="marketprice" sc_type="spec_bunch|marketprice" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	        '<td><input class="text price" type="text" name="spec[spec_bunch][price]" data_type="price" sc_type="spec_bunch|price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
                // 代理商价格
	        // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_1]" data_type="goods_price_1" sc_type="spec_bunch|goods_price_1" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	        // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_2]" data_type="goods_price_2" sc_type="spec_bunch|goods_price_2" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	        // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_3]" data_type="goods_price_3" sc_type="spec_bunch|goods_price_3" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +

            '<td><input class="text stock" type="text" name="spec[spec_bunch][stock]" data_type="stock" sc_type="spec_bunch|stock" value="" /></td>' +
            '<td><input class="text stock" type="text" name="spec[spec_bunch][alarm]" data_type="alarm" sc_type="spec_bunch|alarm" value="" /></td>' +
            '<td><input class="text declare_price" type="text" name="spec[spec_bunch][declare_price]" data_type="declare_price" sc_type="spec_bunch|declare_price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
            '<td><input class="text declare_num" type="text" name="spec[spec_bunch][declare_num]" data_type="declare_num" sc_type="spec_bunch|declare_num" value="" /></td>' +
            '<td><input class="text gross_weight" type="text" name="spec[spec_bunch][gross_weight]" data_type="gross_weight" sc_type="spec_bunch|gross_weight" value="" /></td>' +
            '</tr>';
    }else{
        sub_str +='<td><input class="text sku" type="text" name="spec[spec_bunch][sku]" sc_type="spec_bunch|sku" value="" /></td>' +
            '<td><input class="text price" type="text" name="spec[spec_bunch][marketprice]" data_type="marketprice" sc_type="spec_bunch|marketprice" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
            '<td><input class="text price" type="text" name="spec[spec_bunch][price]" data_type="price" sc_type="spec_bunch|price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +

                // 代理商价格
	        // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_1]" data_type="goods_price_1" sc_type="spec_bunch|goods_price_1" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	        // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_2]" data_type="goods_price_2" sc_type="spec_bunch|goods_price_2" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	        // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_3]" data_type="goods_price_3" sc_type="spec_bunch|goods_price_3" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +

            '<td><input class="text stock" type="text" name="spec[spec_bunch][stock]" data_type="stock" sc_type="spec_bunch|stock" value="" /></td>' +
            '<td><input class="text stock" type="text" name="spec[spec_bunch][alarm]" data_type="alarm" sc_type="spec_bunch|alarm" value="" /></td>' +
            '<td style="display: none"><input class="text declare_price" type="text" name="spec[spec_bunch][declare_price]" data_type="declare_price" sc_type="spec_bunch|declare_price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
            '<td style="display: none"><input class="text declare_num" type="text" name="spec[spec_bunch][declare_num]" data_type="declare_num" sc_type="spec_bunch|declare_num" value="" /></td>' +
            '<td style="display: none"><input class="text gross_weight" type="text" name="spec[spec_bunch][gross_weight]" data_type="gross_weight" sc_type="spec_bunch|gross_weight" value="" /></td>' +
            '</tr>';
      }

      sub_str=sub_str.replace(/spec_bunch/g, spec_bunch);
      str +=sub_str;
    }

      console.log(str)
    //生成字符串结束

    if(str == '<tr>'){
      //  店铺价格 商品库存取消只读
      $('input[name="g_price"]').removeAttr('readonly').css('background','');
      $('input[name="g_storage"]').removeAttr('readonly').css('background','');
      $('input[name="declare_price"]').removeAttr('readonly').css('background','');
      $('input[name="declare_num"]').removeAttr('readonly').css('background','');
      $('input[name="gross_weight"]').removeAttr('readonly').css('background','');
      $('dl[sc_type="spec_dl"]').hide();
    }else{
          $('tbody[sc_type="spec_table"]').empty().html(str)
                  .find('input[sc_type]').each(function(){
            s = $(this).attr('sc_type');
            try{$(this).val(V[s]);}catch(ex){$(this).val('');};
            if ($(this).attr('data_type') == 'marketprice' && $(this).val() == '') {
              $(this).val($('input[name="g_marketprice"]').val());
            }
	          if ($(this).attr('data_type') == 'price' && $(this).val() == ''){
		          $(this).val($('input[name="g_price"]').val());
	          }
	          if ($(this).attr('data_type') == 'goods_price_1' && $(this).val() == ''){
		          $(this).val($('input[name="goods_price_1"]').val());
	          }
	          if ($(this).attr('data_type') == 'goods_price_2' && $(this).val() == ''){
		          $(this).val($('input[name="goods_price_2"]').val());
	          }
	          if ($(this).attr('data_type') == 'goods_price_3' && $(this).val() == ''){
		          $(this).val($('input[name="goods_price_3"]').val());
	          }
            if ($(this).attr('data_type') == 'stock' && $(this).val() == ''){
              $(this).val('0');
            }
            if ($(this).attr('data_type') == 'alarm' && $(this).val() == ''){
              $(this).val('0');
            }
            if ($(this).attr('data_type') == 'declare_price' && $(this).val() == ''){
              $(this).val($('input[name="declare_price"]').val());
            }
            if ($(this).attr('data_type') == 'declare_num' && $(this).val() == ''){
              $(this).val($('input[name="declare_num"]').val());
            }
            if ($(this).attr('data_type') == 'gross_weight' && $(this).val() == ''){
              $(this).val($('input[name="gross_weight"]').val());
            }
          }).end()
                  .find('input[data_type="stock"]').change(function(){
            computeStock();    // 库存计算
          }).end()
                  .find('input[data_type="price"]').change(function(){
            computePrice();     // 价格计算
          }).end()
                  .find('input[data_type="declare_price"]').change(function(){
            computeDeclarePrice();    // 申报单价
          }).end()
                  .find('input[data_type="declare_num"]').change(function(){
            computeDeclareNum();    // 申报数量计算
          }).end()
                  .find('input[data_type="gross_weight"]').change(function(){
            computeGrossWeight();    // 毛重计算
          }).end()
                  .find('input[sc_type]').change(function(){
            s = $(this).attr('sc_type');
            V[s] = $(this).val();
          });

    }
  }

  <?php
          /**
           *
           *
           *  生成需要的js循环。递归调用	PHP
           *
           *  形式参考 （ 2个规格）
           *  $('input[type="checkbox"]').click(function(){
           *      str = '';
           *      for (var i=0; i<spec_group_checked[0].length; i++ ){
           *      td_1 = spec_group_checked[0][i];
           *          for (var j=0; j<spec_group_checked[1].length; j++){
           *              td_2 = spec_group_checked[1][j];
           *              str += '<tr><td>'+td_1[0]+'</td><td>'+td_2[0]+'</td><td><input type="text" /></td><td><input type="text" /></td><td><input type="text" /></td>';
           *          }
           *      }
           *      $('table[class="spec_table"] > tbody').empty().html(str);
           *  });
           */
          function recursionSpec($len,$sign) {
            echo "var checked_group=new Array();\n";
            for($i=0; $i< $sign; $i++){
              echo "if(spec_group_checked['".$i."'].length>0){ checked_group.push('".$i."'); }\n";
            }


          }

                  ?>

  <?php if (!empty($goods) && !empty($sp_value) && !empty($spec_checked) && !empty($spec_list)){?>

//  编辑商品时处理JS
    $(function(){
      var E_SP = new Array();
      var E_SPV = new Array();
      {php}
      $string = '';
      foreach ($spec_checked as $v) {
        $string .= "E_SP[".$v['id']."] = '".$v['name']."';";
      }
      echo $string;
      echo "\n";
      $string = '';
      foreach ($sp_value as $k=>$v) {
        $string .= "E_SPV['".$k."'] = '".$v."';";
      }
      echo $string;
      {/php}
        V = E_SPV;
        $('dl[sc_type="spec_dl"]').show();
        $('dl[sctype="spec_group_dl"]').find('input[type="checkbox"]').each(function(){

          //  店铺价格 商品库存改为只读
          $('input[name="g_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
          $('input[name="g_storage"]').attr('readonly','readonly').css('background','#E7E7E7 none');
          s = $(this).attr('sc_type');
          if (!(typeof(E_SP[s]) == 'undefined')){
            $(this).prop('checked',true);
            v = $(this).parents('li').find('span[sctype="pv_name"]');
            if(E_SP[s] != ''){
              $(this).val(E_SP[s]);
              v.html('<input type="text" maxlength="20" value="'+E_SP[s]+'" />');
            }else{
              v.html('<input type="text" maxlength="20" value="'+v.html()+'" />');
            }
            change_img_name($(this));			// 修改相关的颜色名称
          }
        });

        into_array();	// 将选中的规格放入数组
        str = '<tr>';
      <?php recursionSpec(0,$sign_i);?>

        //生成字符串开始

        var total_length=0;
        for(var i in checked_group){
          $('[data-type=spec_name_'+(i)+']').show();
          if(total_length==0){
            total_length=1;
          }
          total_length=total_length*spec_group_checked[checked_group[i]].length;
        }

        var k=new Array();
        var l=0;
        var n=0;
        for(var j=0;j<total_length;j++){
          var spec_bunch='i_';
          var sub_str='';
          sub_str += '<input type="hidden" name="spec[spec_bunch][goods_id]" sc_type="spec_bunch|id" value="" />';
          for(var i in checked_group){


            if(typeof(k[checked_group[i]])=='undefined'){
              k[checked_group[i]]=0;
            }
            spec_bunch+=spec_group_checked[checked_group[i]][k[checked_group[i]]][1];
            if (spec_group_checked[checked_group[i]][k[checked_group[i]]][2] != null) { sub_str += '<input type="hidden" name="spec[spec_bunch][color]" value="'+spec_group_checked[checked_group[i]][k[checked_group[i]]][1]+'" />';}
            sub_str +='<td><input type="hidden" name="spec[spec_bunch][sp_value]['+spec_group_checked[checked_group[i]][k[checked_group[i]]][1]+']" value="'+spec_group_checked[checked_group[i]][k[checked_group[i]]][0]+'" />'+spec_group_checked[checked_group[i]][k[checked_group[i]]][0]+'</td>';

            if(i==(checked_group.length-1)){
              k[checked_group[i]]++;
              if(k[checked_group[i]]==spec_group_checked[checked_group[i]].length){
                for(var m = (checked_group.length-1);m>=0;m--){
                  if(k[checked_group[m]]<(spec_group_checked[checked_group[m]].length-1)){
                    k[checked_group[m]]++;
                    break;
                  }else{
                    k[checked_group[m]]=0;
                  }
                }
              }
            }
          }
if($('input[name="trade_mode"]:checked').val() > 1){
  sub_str +='<td><input class="text sku" type="text" name="spec[spec_bunch][sku]" sc_type="spec_bunch|sku" value="" /></td>' +
      '<td><input class="text price" type="text" name="spec[spec_bunch][marketprice]" data_type="marketprice" sc_type="spec_bunch|marketprice" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
      '<td><input class="text price" type="text" name="spec[spec_bunch][price]" data_type="price" sc_type="spec_bunch|price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	  // // 代理商价格
	  // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_1]" data_type="goods_price_1" sc_type="spec_bunch|goods_price_1" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	  // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_2]" data_type="goods_price_2" sc_type="spec_bunch|goods_price_2" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	  // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_3]" data_type="goods_price_3" sc_type="spec_bunch|goods_price_3" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +

      '<td><input class="text stock" type="text" name="spec[spec_bunch][stock]" data_type="stock" sc_type="spec_bunch|stock" value="" /></td>' +
      '<td><input class="text stock" type="text" name="spec[spec_bunch][alarm]" data_type="alarm" sc_type="spec_bunch|alarm" value="" /></td>' +
      '<td><input class="text declare_price" type="text" name="spec[spec_bunch][declare_price]" data_type="declare_price" sc_type="spec_bunch|declare_price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
      '<td><input class="text declare_num" type="text" name="spec[spec_bunch][declare_num]" data_type="declare_num" sc_type="spec_bunch|declare_num" value="" /></td>' +
      '<td><input class="text gross_weight" type="text" name="spec[spec_bunch][gross_weight]" data_type="gross_weight" sc_type="spec_bunch|gross_weight" value="" /></td>' +
      '</tr>';
        }else{
  sub_str +='<td><input class="text sku" type="text" name="spec[spec_bunch][sku]" sc_type="spec_bunch|sku" value="" /></td>' +
      '<td><input class="text price" type="text" name="spec[spec_bunch][marketprice]" data_type="marketprice" sc_type="spec_bunch|marketprice" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
      '<td><input class="text price" type="text" name="spec[spec_bunch][price]" data_type="price" sc_type="spec_bunch|price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	  // 代理商价格
	  // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_1]" data_type="goods_price_1" sc_type="spec_bunch|goods_price_1" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	  // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_2]" data_type="goods_price_2" sc_type="spec_bunch|goods_price_2" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
	  // '<td><input class="text price" type="text" name="spec[spec_bunch][goods_price_3]" data_type="goods_price_3" sc_type="spec_bunch|goods_price_3" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
      '<td><input class="text stock" type="text" name="spec[spec_bunch][stock]" data_type="stock" sc_type="spec_bunch|stock" value="" /></td>' +
      '<td><input class="text stock" type="text" name="spec[spec_bunch][alarm]" data_type="alarm" sc_type="spec_bunch|alarm" value="" /></td>' +
      '<td style="display: none"><input class="text declare_price" type="text" name="spec[spec_bunch][declare_price]" data_type="declare_price" sc_type="spec_bunch|declare_price" value="" /><em class="add-on"><i class="fa fa-cny"></i></em></td>' +
      '<td style="display: none"><input class="text declare_num" type="text" name="spec[spec_bunch][declare_num]" data_type="declare_num" sc_type="spec_bunch|declare_num" value="" /></td>' +
      '<td style="display: none"><input class="text gross_weight" type="text" name="spec[spec_bunch][gross_weight]" data_type="gross_weight" sc_type="spec_bunch|gross_weight" value="" /></td>' +
      '</tr>';
        }

          sub_str=sub_str.replace(/spec_bunch/g, spec_bunch);
          str +=sub_str;
        }
        //生成字符串结束


        if(str == '<tr>'){
          $('dl[sc_type="spec_dl"]').hide();
          $('input[name="g_price"]').removeAttr('readonly').css('background','');
          $('input[name="g_storage"]').removeAttr('readonly').css('background','');
        }else{
	        $('tbody[sc_type="spec_table"]').empty().html(str)
		        .find('input[sc_type]').each(function(){
		        var s = $(this).attr('sc_type');
		        try{$(this).val(E_SPV[s]);}catch(ex){$(this).val('');};
	        }).end()
		        .find('input[data_type="stock"]').change(function(){
		        computeStock();    // 库存计算
	        }).end()
		        .find('input[data_type="price"]').change(function(){
		        computePrice();     // 价格计算
	        }).end()
		        .find('input[type="text"]').change(function(){
		        s = $(this).attr('sc_type');
		        V[s] = $(this).val();
	        });
        }
      });
  <?php }?>
</script>






















</div>  
